/*******************************************************************************
 * Copyright (c) 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
		var jsUrls=new Array();
	jsUrls[0]=__ctxPath+"/resource/member/js/userfriendSelector.js";
	$importJs(jsUrls,function(){
	});
	//type:
	//	1:邀请好友参与投票 ，2:推荐产品给好友
	function sendMsg(txtTitle,voteId,userId,type){
		checkUser(forwordMsg);
	function forwordMsg(){
		var urlDialog=encodeURI(__ctxPath+"/member/user/forwordMsgDialog.do?messageTopic="+txtTitle+"&voteId="+voteId+"&userId="+userId+"&type="+type+"&decorator=blank");
		createOverlayDlg("sendMsg",{
			title:'转发信息给好友',
			width:800,
			height:600,
			bgiframe: true,
			buttons:{
				"发送":function (){		
			var hiddId=$("#hiddId").val();
			var messageTopic=$("#messageTopic").val();
			var toList=$("#toList").val();
			var messageBody=$("#messageBody").val();
			if(messageTopic==""){
				alert("标题为空!");
				$("#messageTopic").focus();
				return false;
			}
			if(messageBody==""){
				alert("内容为空!");
				$("#messageBody").focus();
				return false;
			}
			var friend=$("#toList").val();
			if(friend==""){
				alert("请选择好友!");
				return false;
			}
			var url="";
				$.ajax({
					 type: "post",
					  url:__ctxPath+"/member/user/sendMsg.do?cmd=doSendMoreMsg",
					  data:{messageTopic:messageTopic,toList:toList,messageBody:messageBody,hiddId:hiddId},
					  cache: false,
					  success: function(){
						alert('发送成功.');
						$("#sendMsg").dialog("close");
					  },
					  error: function(){
						  alert('发送失败!');
						  }
				  })
				},
				"取 消":function (){$(this).dialog("close");}
				},
				url:urlDialog
		});
	}
	}